package com.fyzk.activity.lottery.zc_new;


import com.fyzk.activity.lottery.jc.football.JZBetNumUtil;
import com.fyzk.activity.lottery.zc_new.adapter.ZCBaseAdapter;
import com.fyzk.activity.lottery.zc_new.adapter.ZCSFCAdapter_New;
import com.fyzk.bean.ZCGameQueueItem;
import com.tyjc.lottery.R;
import com.fyzk.utils.HelpUrlConstants;
import com.fyzk.utils.LotteryIDUtils;

import java.util.ArrayList;
import java.util.List;

public class OldFootballSFCActivity_New extends ZCBaseActivity_New{
	
	private ZCSFCAdapter_New adapter;

	@Override
	protected String getTopTitle() {
		// TODO Auto-generated method stub
		return getString(R.string.zc_sfc);
	}

	@Override
	protected int getLotteryID() {
		// TODO Auto-generated method stub
		return LotteryIDUtils.ZCSFC_LOTTERY_ID_INT;
	}

	@Override
	protected void changeAdapter(List<ZCGameQueueItem> infors) {
		// TODO Auto-generated method stub
		adapter.setList(infors);
	}

	@Override
	protected ZCBaseAdapter getAdapter(List<ZCGameQueueItem> infors) {
		// TODO Auto-generated method stub
		adapter = new ZCSFCAdapter_New(this, infors);
		adapter.setOnZCTongJiListener(this);
		return adapter;
	}

	@Override
	protected int minChangCi() {
		// TODO Auto-generated method stub
		return 14;
	}
	
	@Override
	protected void jiSuanZhu(List<ZCGameQueueItem> infors) {
		// TODO Auto-generated method stub
		List<Integer> clicknums = new ArrayList<Integer>();
		List<Boolean> dannums = new ArrayList<Boolean>();
		for (int i = 0; i < infors.size(); i++) {
			ZCGameQueueItem info = infors.get(i);
			if (info.isSheng() || info.isPing() || info.isFu()) {
				changCi++;
			}
			
			clicknums.add(info.clickNum);
			dannums.add(false);
		}
		if (changCi >= minChangCi()) {
			zhuShu = JZBetNumUtil.getZhushu(minChangCi(), clicknums, dannums);
		}
	}

	@Override
	protected void randomBallNum(List<ZCGameQueueItem> infors) {
		// TODO Auto-generated method stub
		for (int i = 0; i < infors.size(); i++) {
			ZCGameQueueItem info = infors.get(i);
			int random = (int) (Math.random()*3);
			switch (random) {
			case 0:
				info.setSheng(true);
				break;
			case 1:
				info.setPing(true);
				break;
			case 2:
				info.setFu(true);
				break;
			default:
				break;
			}
			info.clickNum = 1;
		}
	}

	@Override
	protected int getWcodeID(int zhuShu, boolean isDanTuo) {
		// TODO Auto-generated method stub
		if (zhuShu > 1) {
			return LotteryIDUtils.ZCSFC_LOTTERY_COMMON_FU_INT;
		}else{
			return LotteryIDUtils.ZCSFC_LOTTERY_COMMON_DAN_INT;
		}
	}
	
	@Override
	protected String getHelpUrl() {
		// TODO Auto-generated method stub
		return HelpUrlConstants.Help_SFC;
	}

	@Override
	protected String getHelpTitle() {
		// TODO Auto-generated method stub
		return getString(R.string.help_zcsfc);
	}

}
